home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20021006-20030409 / 000319_b.stewart@bom.gov.au_Mon Feb 17 19:39:16 EST 2003.msg < prev    next >
Text File  |  2020-01-01  |  15KB  |  336 lines

  1. Article: 14115 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!phl-feed.news.verio.net!iad-feed.news.verio.net!ord-feed.news.verio.net!stl-feed.news.verio.net!news.cc.ukans.edu!logbridge.uoregon.edu!snoopy.risq.qc.ca!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!news1.optus.net.au!optus!ken-transit.news.telstra.net!news.telstra.net!vicpull1.telstra.net!not-for-mail
  3. Message-ID: <3E517E98.D89D779C@bom.gov.au>
  4. From: Bruce Stewart <b.stewart@bom.gov.au>
  5. X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U)
  6. X-Accept-Language: en
  7. MIME-Version: 1.0
  8. Newsgroups: comp.protocols.kermit.misc
  9. Subject: Re: Running multiple kermit scripts on one connection
  10. References: <775a2ab0.0302171458.f8f21f9@posting.google.com> <b2rrbl$ks3$1@watsol.cc.columbia.edu>
  11. Content-Type: multipart/alternative;
  12.  boundary="------------0E4B00F8CCF00119C91BFB8D"
  13. Lines: 314
  14. Date: Tue, 18 Feb 2003 11:30:17 +1100
  15. NNTP-Posting-Host: 134.178.5.131
  16. X-Complaints-To: abuse@telstra.net
  17. X-Trace: vicpull1.telstra.net 1045527997 134.178.5.131 (Tue, 18 Feb 2003 11:26:37 EST)
  18. NNTP-Posting-Date: Tue, 18 Feb 2003 11:26:37 EST
  19. Organization: Customer of Telstra Internet Direct
  20. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14115
  21.  
  22.  
  23. --------------0E4B00F8CCF00119C91BFB8D
  24. Content-Type: text/plain; charset=us-ascii
  25. Content-Transfer-Encoding: 7bit
  26.  
  27. OK, that second method sounds like it would do the job. I will give it a try
  28. but first I want to ask you another question.
  29.  
  30. I have been looking at the documentation and found the following under
  31. Command-line options:
  32.  
  33.  -l _number
  34.  
  35. where number refers to the Windows device handle for a communication
  36. connection that has already been opened by another process.
  37.  
  38. So, assuming I could open a device handle to the local modem say,
  39. within my program, and pass that into each instance of kermit opened to
  40. run each script, that should also do the job I think.
  41.  
  42. I tried the following to test it:
  43. 1-I opened a kermit instance, and opened a connection to com port
  44.    2, which is where the modem is connected.
  45. 2-I then tried to open another instance of kermit using the follwoing
  46.    line:
  47.       run k95 -l _\v(ttyfd),
  48.  
  49.       but got the following respose when the other kermit instance opened:
  50.  
  51.       "can't open device",
  52.  
  53. Now, I don't know whether the file descriptor is the same as the
  54. windows device handle. Maybe they are totally different. I will try doing
  55. it from the program, opening a device handle and passing that into each
  56. kermit instance. Hopefully that will work.
  57.  
  58. Do you know anything that may be important regarding this way?
  59.  
  60. Frank da Cruz wrote:
  61.  
  62. > In article <775a2ab0.0302171458.f8f21f9@posting.google.com>,
  63. > Minty <metceed@yahoo.com> wrote:
  64. > : I'm trying to run multiple kermit scripts over one dial-up connection.
  65. > : More specifically:
  66. > :
  67. > : I am writing a program that will automatically send an alert. One the
  68. > : the ways it sends an alert is via an sms message. I have an account
  69. > : with an pstn-to-sms gateway provider. So I can dial-up this gateway
  70. > : modem, and using the TAP protocol, I can send sms messages.
  71. > :
  72. > : What I want to do is control, within my program, the 2 main aspects of
  73. > : the sending process. The 'loggin on' part, and the 'sending messages
  74. > : part'. I already have a kermit script that does both. I want to
  75. > : seperate those to parts and call them seperately from my program. The
  76. > : reason is that there could be many messages going out for the one
  77. > : connection. This is decided at run-time. Another reason is so that the
  78. > : program can know which alerts got sent and which didn't.
  79. > :
  80. > : So, if for example I'm sending out 2 alerts, the steps would be as
  81. > : follows:
  82. > :
  83. > : 1-The program would run a kermit script, that opens connection from
  84. > : local pc to local modem, dials the gateway modem and logs on, as per
  85. > : the TAP protocol. The script would be called with the gateway provider
  86. > : number as parameter.
  87. > :
  88. > : 2-Then the program would run another kermit script, that sends
  89. > : messages as per TAP protocol, with the message and sms number as
  90. > : parameters, noting the exit code.
  91. > :
  92. > : 3-It would again call the same send script with another message and
  93. > : another number as parameter, again noting the exit code.
  94. > :
  95. > : 4-It calls another scipt, that logs off the connection to the gateway
  96. > : modem, and also closes connection from local pc to local modem.
  97. > :
  98. > : Now, the problem I have noted with running multiple kermit scripts, is
  99. > : that at the end of running one script, it closes the connection to the
  100. > : gateway modem and also the connection from the local pc to the local
  101. > : modem.
  102. > :
  103. > : I'm using the latest kermit 95 version on a Windows 2000 machine.
  104. > :
  105. > : Anyone have any ideas on how I could do this? I'm sure it's only a
  106. > : setting I would have to set with kermit, but I haven't found it.
  107. > :
  108. > : One idea I did try was to manually open an instance of kermit and open
  109. > : connection to local modem manually. Then call the other scripts to use
  110. > : this connection, but they wouldn't use it.
  111. > :
  112. > Ideally you'd like to be able to start Kermit and then send it messages
  113. > when you want it to do something.  Unfortunately, Kermit doesn't have a
  114. > way to wait for or send messages, so we have to devise a cunning plan.
  115. >
  116. > One idea would be to turn your application upside down and let Kermit
  117. > control the sequence of events.  For example, it could make the call, log
  118. > in, and then run your application with a command-line argument that says
  119. > "OK I'm logged in, now what?" and waits for your application to terminate.
  120. > At this point it can dispatch based on the return code, perhaps looking in
  121. > a prearranged file for instructions.  Repeat as needed.
  122. >
  123. > If that's not practical, there is a little-known way of making Kermit wait
  124. > for an event:
  125. >
  126. >   WAIT <interval-or-clock-time> FILE CREATION <filename>
  127. >
  128. > ("help wait" for details.)  This is admittedly a hack, and it would
  129. > require the same thing in the other direction, because at this point
  130. > Kermit is still running.
  131. >
  132. > Thus your application would have to spawn Kermit asynchronously, then
  133. > wait for a prearranged file to appear, which Kermit would create just
  134. > before doing the WAIT.  Then your application would do whatever it does,
  135. > and then when it's ready for Kermit to send a message, it would create
  136. > another prearranged file, the one that Kermit is WAITing for.  Obviously,
  137. > it would be handy if this file contained the message details.
  138. >
  139. > So the Kermit script would go about like this:
  140. >
  141. >   Make the call and log in.
  142. >   If this failed, return a failure code.
  143. >   If it succeeds, create the "I'm logged in" file.
  144. >   While true {
  145. >       Wait for message file.
  146. >       If message file says "Finished" {
  147. >           delete the "I'm logged in" file
  148. >           Hang up and exit.
  149. >       } else {
  150. >           send the message.
  151. >           delete (or rename) the message file
  152. >       }
  153. >   }
  154. >
  155. > Meanwhile your application would:
  156. >
  157. >   Spawn Kermit asynchronously
  158. >   Wait for the "I'm logged in" file
  159. >   While true {
  160. >       Make sure "I'm logged in" file still exists.
  161. >       Get a message to send.
  162. >       Create message file.
  163. >       Wait for message file to disappear.
  164. >   }
  165. >
  166. > Does this help?  It's not the fashiable TLA du jour but we've never been
  167. > particularly concerned with fashion :-)
  168. >
  169. > Obviously refinements are possible, such as queueing and various forms of
  170. > bulletproofing.
  171. >
  172. > - Frank
  173.  
  174. --------------0E4B00F8CCF00119C91BFB8D
  175. Content-Type: text/html; charset=us-ascii
  176. Content-Transfer-Encoding: 7bit
  177.  
  178. <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  179. <html>
  180. OK, that second method sounds like it would do the job. I will give it
  181. a try
  182. <br>but first I want to ask you another question.
  183. <p>I have been looking at the documentation and found the following under
  184. <br>Command-line options:
  185. <p> -l _<i>number</i><i></i>
  186. <p>where <i>number</i> refers to the Windows device handle for a communication
  187. <br>connection that has already been opened by another process.
  188. <p>So, assuming I could open a device handle to the local modem say,
  189. <br>within my program, and pass that into each instance of kermit opened
  190. to
  191. <br>run each script, that should also do the job I think.
  192. <p>I tried the following to test it:
  193. <br>1-I opened a kermit instance, and opened a connection to com port
  194. <br>   2, which is where the modem is connected.
  195. <br>2-I then tried to open another instance of kermit using the follwoing
  196. <br>   line:
  197. <br>      run k95 -l _\v(ttyfd),
  198. <p>      but got the following respose when the
  199. other kermit instance opened:
  200. <br> 
  201. <br>      "can't open device",
  202. <p>Now, I don't know whether the file descriptor is the same as the
  203. <br>windows device handle. Maybe they are totally different. I will try
  204. doing
  205. <br>it from the program, opening a device handle and passing that into
  206. each
  207. <br>kermit instance. Hopefully that will work.
  208. <p>Do you know anything that may be important regarding this way?
  209. <p>Frank da Cruz wrote:
  210. <blockquote TYPE=CITE>In article <775a2ab0.0302171458.f8f21f9@posting.google.com>,
  211. <br>Minty <metceed@yahoo.com> wrote:
  212. <br>: I'm trying to run multiple kermit scripts over one dial-up connection.
  213. <br>: More specifically:
  214. <br>:
  215. <br>: I am writing a program that will automatically send an alert. One
  216. the
  217. <br>: the ways it sends an alert is via an sms message. I have an account
  218. <br>: with an pstn-to-sms gateway provider. So I can dial-up this gateway
  219. <br>: modem, and using the TAP protocol, I can send sms messages.
  220. <br>:
  221. <br>: What I want to do is control, within my program, the 2 main aspects
  222. of
  223. <br>: the sending process. The 'loggin on' part, and the 'sending messages
  224. <br>: part'. I already have a kermit script that does both. I want to
  225. <br>: seperate those to parts and call them seperately from my program.
  226. The
  227. <br>: reason is that there could be many messages going out for the one
  228. <br>: connection. This is decided at run-time. Another reason is so that
  229. the
  230. <br>: program can know which alerts got sent and which didn't.
  231. <br>:
  232. <br>: So, if for example I'm sending out 2 alerts, the steps would be as
  233. <br>: follows:
  234. <br>:
  235. <br>: 1-The program would run a kermit script, that opens connection from
  236. <br>: local pc to local modem, dials the gateway modem and logs on, as
  237. per
  238. <br>: the TAP protocol. The script would be called with the gateway provider
  239. <br>: number as parameter.
  240. <br>:
  241. <br>: 2-Then the program would run another kermit script, that sends
  242. <br>: messages as per TAP protocol, with the message and sms number as
  243. <br>: parameters, noting the exit code.
  244. <br>:
  245. <br>: 3-It would again call the same send script with another message and
  246. <br>: another number as parameter, again noting the exit code.
  247. <br>:
  248. <br>: 4-It calls another scipt, that logs off the connection to the gateway
  249. <br>: modem, and also closes connection from local pc to local modem.
  250. <br>:
  251. <br>: Now, the problem I have noted with running multiple kermit scripts,
  252. is
  253. <br>: that at the end of running one script, it closes the connection to
  254. the
  255. <br>: gateway modem and also the connection from the local pc to the local
  256. <br>: modem.
  257. <br>:
  258. <br>: I'm using the latest kermit 95 version on a Windows 2000 machine.
  259. <br>:
  260. <br>: Anyone have any ideas on how I could do this? I'm sure it's only
  261. a
  262. <br>: setting I would have to set with kermit, but I haven't found it.
  263. <br>:
  264. <br>: One idea I did try was to manually open an instance of kermit and
  265. open
  266. <br>: connection to local modem manually. Then call the other scripts to
  267. use
  268. <br>: this connection, but they wouldn't use it.
  269. <br>:
  270. <br>Ideally you'd like to be able to start Kermit and then send it messages
  271. <br>when you want it to do something.  Unfortunately, Kermit doesn't
  272. have a
  273. <br>way to wait for or send messages, so we have to devise a cunning plan.
  274. <p>One idea would be to turn your application upside down and let Kermit
  275. <br>control the sequence of events.  For example, it could make the
  276. call, log
  277. <br>in, and then run your application with a command-line argument that
  278. says
  279. <br>"OK I'm logged in, now what?" and waits for your application to terminate.
  280. <br>At this point it can dispatch based on the return code, perhaps looking
  281. in
  282. <br>a prearranged file for instructions.  Repeat as needed.
  283. <p>If that's not practical, there is a little-known way of making Kermit
  284. wait
  285. <br>for an event:
  286. <p>  WAIT <interval-or-clock-time> FILE CREATION <filename>
  287. <p>("help wait" for details.)  This is admittedly a hack, and it would
  288. <br>require the same thing in the other direction, because at this point
  289. <br>Kermit is still running.
  290. <p>Thus your application would have to spawn Kermit asynchronously, then
  291. <br>wait for a prearranged file to appear, which Kermit would create just
  292. <br>before doing the WAIT.  Then your application would do whatever
  293. it does,
  294. <br>and then when it's ready for Kermit to send a message, it would create
  295. <br>another prearranged file, the one that Kermit is WAITing for. 
  296. Obviously,
  297. <br>it would be handy if this file contained the message details.
  298. <p>So the Kermit script would go about like this:
  299. <p>  Make the call and log in.
  300. <br>  If this failed, return a failure code.
  301. <br>  If it succeeds, create the "I'm logged in" file.
  302. <br>  While true {
  303. <br>      Wait for message file.
  304. <br>      If message file says "Finished" {
  305. <br>          delete the "I'm
  306. logged in" file
  307. <br>          Hang up and
  308. exit.
  309. <br>      } else {
  310. <br>          send the message.
  311. <br>          delete (or rename)
  312. the message file
  313. <br>      }
  314. <br>  }
  315. <p>Meanwhile your application would:
  316. <p>  Spawn Kermit asynchronously
  317. <br>  Wait for the "I'm logged in" file
  318. <br>  While true {
  319. <br>      Make sure "I'm logged in" file still
  320. exists.
  321. <br>      Get a message to send.
  322. <br>      Create message file.
  323. <br>      Wait for message file to disappear.
  324. <br>  }
  325. <p>Does this help?  It's not the fashiable TLA du jour but we've never
  326. been
  327. <br>particularly concerned with fashion :-)
  328. <p>Obviously refinements are possible, such as queueing and various forms
  329. of
  330. <br>bulletproofing.
  331. <p>- Frank</blockquote>
  332. </html>
  333.  
  334. --------------0E4B00F8CCF00119C91BFB8D--
  335.  
  336.